<% content_for :bottom do -%>
  <%= javascript_include_tag 'admin/merchandise_product' %>
<% end %>

<% content_for :below_body do -%>
  <script>
    Hadean.AdminMerchandiseProductForm.initialize(<%= @product.id %>);
  </script>
<% end %>

<%= error_messages_for 'product' %>

<label>Name</label>
<%= form.text_field :name %>

<label>Permalink</label>
<%= form.text_field :permalink %>

<label>Search Keywords</label>
<%= form.text_field :set_keywords, :placeholder => "separate keywords with a comma" %>

<label>Meta Keywords</label>
<%= form.text_field :meta_keywords %>

<label>Meta Description</label>
<%= form.text_field :meta_description %>

<label>Product Type</label>
<%= form.select :product_type_id, @select_product_types %>

<label>Shipping Category</label>
<%= form.select :shipping_category_id, @select_shipping_category %>

<label>Brand</label>
<%= form.select :brand_id, @brands %>

<fieldset>
  <legend>Properties</legend>

  <div id="product_properties" class='six large-6 '>
    <% @all_properties.each do |property| %>
      <div id='property_<%= property.id %>'
            class="property_form left last"
            <%= "style='display:none;'" if @product.id && !@product.properties.detect {|p| p.id == property.id} %>>
        <%= form.fields_for :product_properties, property.product_properties.find_or_initialize_by(product_id: @product.id) do |product_property_form|%>
          <label><%= property.full_name %></label>
          <%= product_property_form.hidden_field :property_id %>
          <label>Description:</label> <%= product_property_form.text_field :description %>
        <% end %>
      </div>
    <% end %>
  </div>
</fieldset>
